package cn.edu.jxau.service;

import java.text.SimpleDateFormat;
import java.util.Date;

import cn.edu.jxau.dao.NotificationDao;
import cn.edu.jxau.domain.notification;
import cn.itcast.commons.CommonUtils;

public class addNotification {
  
	public static void pushNotification(String title,String picturepath,String content,String flag){
		
		Date pushdate=new Date();//获取推送公告的时间并且格式化为指定的格式
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String  time=sdf.format(pushdate);
		notification notification=new notification();
		 //生成32为的uuid作为帖子的id
		String uuid=CommonUtils.uuid();
		
		notification.setNotificationID(uuid);//资讯编号
		notification.setTitle(title);
        notification.setLocation(picturepath);//设置图片保存位置的路径
        notification.setContent(content);
        notification.setFlag(flag); //设置前台显示的位置
        notification.setUpdatetime(time);//设置推送时间
        
        NotificationDao notificationDao=new NotificationDao();
        notificationDao.addNotificationDao(notification);
        
	}	
}
